<template>
  <div>
    <el-form ref="Form" :model="Form" :rules="Rules" label-width="150px" class="business-form" auto-complete="on">
       <el-form-item prop="qq" label="QQ联系">
         <el-input class="default-input" v-model="Form.qq" placeholder="请输入QQ" />
       </el-form-item>
       <el-form-item label="微信联系">
         <el-input class="default-input" v-model="Form.wechat" placeholder="请输入微信号" />
       </el-form-item>
       <el-form-item prop="daysOne" label="有效时间一（天）">
         <el-input class="default-input" v-model="Form.daysOne" placeholder="请输入有效时间一" />
       </el-form-item>
       <el-form-item prop="priceOne" label="价格一（元）">
         <el-input class="default-input" v-model="Form.priceOne" placeholder="请输入价格一" />
       </el-form-item>
       <el-form-item prop="daysTwo" label="有效时间二（天）">
         <el-input class="default-input" v-model="Form.daysTwo" placeholder="请输入有效时间二" />
       </el-form-item>
       <el-form-item prop="priceTwo" label="价格二（元）">
         <el-input class="default-input" v-model="Form.priceTwo" placeholder="请输入价格二" />
       </el-form-item>
       <el-form-item prop="daysThree" label="有效时间三（天）">
         <el-input class="default-input" v-model="Form.daysThree" placeholder="请输入有效时间三" />
       </el-form-item>
       <el-form-item prop="priceThree" label="价格三（元）">
         <el-input class="default-input" v-model="Form.priceThree" placeholder="请输入价格三" />
       </el-form-item>
       <el-form-item>
         <el-button class="btn-submit" type="primary" @click.native.prevent="handleAdd">
           修改
         </el-button>
       </el-form-item>
     </el-form>
  </div>
</template>

<script>
import { list, update } from '@/api/business/callus'
export default {
  data() {
    return {
      Form: {
        qq: null,
        wechat: null,
        configId: null,
        daysOne: null,
        priceOne: null,
        daysTwo: null,
        priceTwo: null,
        daysThree: null,
        priceThree: null,
      },
      Rules: {
        qq: [{
          required: true, trigger: 'blur', message: '请输入QQ号'
        }],
        wechat: [{
          required: true, trigger: 'blur', message: '请输入微信号'
        }],
      },
    }
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      list().then(res=>{
        console.log(res)
        this.Form = res.content[0];
      })
    },
    handleAdd() {
      this.$refs.Form.validate(valid => {
       if (valid) {
           update(this.Form).then(res=>{
             this.actionsAfter('修改成功！', 'success');
           })
         }
       })
     }
  }
}
</script>

<style lang="css">
</style>
